package test;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by eason on 2017/9/25.
 */
public class StringDemo {


    public static void main(String[] args) {
        List fatherList =new LinkedList();
        List childList  =new ArrayList();
        childList.add("bef");
        fatherList.add(childList);
        childList.add("after");
        System.out.println(fatherList.size());;
        String  s1 ="hello";
        String s2 ="world";
        System.out.println(s1 +"----"+s2);
        change(s1,s2);
        System.out.println(s1 +"----"+s2);
        StringBuffer stringBuffer1 =new StringBuffer("hello");
        StringBuffer stringBuffer2 =new StringBuffer("world");
        System.out.println(stringBuffer1+"____"+stringBuffer2);
        change(stringBuffer1,stringBuffer2);
        System.out.println(stringBuffer1+"____"+stringBuffer2);
        add(fatherList);
        System.out.println(fatherList.size());;
        Person person  =new Person();
        Person person2  =new Person();
        System.out.println(person.age + "\t"+person.name+"\t"+person);
        person.age="20";
        person.name="zhuli";
        person2=person;
        //per(person);

        System.out.println("person : "+person.age + "\t"+person.name+"\t" +person);
        System.out.println("person2: "+person2.age + "\t"+person2.name+"\t"+person2);
        person2.age="PERSON";
       // perC(person,person2);
        System.out.println("person : "+person.age + "\t"+person.name+"\t" +person);
        System.out.println("person2: "+person2.age + "\t"+person2.name+"\t"+person2);
        System.out.println(person.age + "\t"+person.name+"\t"+person);
        System.out.println(person2.age + "\t"+person2.name+"\t"+person2);

        System.out.println(person.age + "\t"+person.name+"\t"+person);
    }


    public static void change(String str1,String str2) {
        str1 =str2;
        str2=str1+str2;

    }

    public static void change(StringBuffer str1,StringBuffer str2) {
        str1 =str2;
        str2.append(str1);

    }

    private static void  add( List list){
        list.add("213213213");
    }
/*    private static void per(Person p){
       // p= new Person();
        p.age="20";
        p.name="zhuli";
    }
    private static void perC(Person p,Person p2){
      //Person  p1= new Person();
      //p=new Person();
      p2=p;
      p=p2;
     // p1.age ="p1";
    }*/

}
  class Person{
     String age  ="10";
    String  name ="张三";
}
